package com.gs.api.config.api;

import cn.hutool.core.lang.Snowflake;
import com.gs.api.config.Constant;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author guoyunfei on 2021/10/29 9:58
 * @className SnowflakeService
 * @description TODO
 * @Version 1.0
 */

@Component
public class SnowflakeService {

    @Resource
    private Snowflake snowflake;

    /**
     * 获取雪花算法生成ID
     * @return
     */
    public String getDySnowflakeNo(){
        return Constant.ORDER_NO_PREFIX + snowflake.nextId();
    }

}
